package com.woniu.controller;/*
 *
 * @author   米雷
 * @Description
 * @Date:create in 16:43 2020-03-27
 *
 * */

import com.woniu.pojo.Complain;
import com.woniu.service.ComplainServcie;
import com.woniu.userLog.LogPoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Api(tags = "用户投诉相关")
@CrossOrigin(allowCredentials = "true",maxAge = 3600)
@Controller
@RequestMapping("/Complain")
public class ComplainController {
    @Autowired
    ComplainServcie complainServcie;


    /*
    * @auth  米雷
    * 增加投诉
    * */
    @ApiOperation(value = "增加投诉")
    @PutMapping("/add")
    @ResponseBody
    @LogPoint("用户投诉")
    public String addComp(Complain complain){
       String result= complainServcie.insert(complain);
       return result;
    }

    /*
     * @auth  米雷
     * 查看投诉
     * */
    @ApiOperation(value = "查看投诉")
    @GetMapping("/get")
    @ResponseBody
    @LogPoint("用户查看投诉")
    public List<Complain> getComp(Long id){
        List list=complainServcie.getCompByUserId(id);
        return list;
    }
}
